"""
@author: yangy
@file: 爬取图片.py
@time: 2023/5/30 20:35
"""
import re
import requests

url = "https://www.sanchuangedu.cn/"
response = requests.get(url)
html_cont = response.text

image_urls = re.findall(r'<img\s+src=([^"\'>\s]+)', html_cont)

print(image_urls)
for image_url in image_urls:
    print(image_url)
    print_url = url+image_url
    resp = requests.get(print_url)
    if resp.status_code == 200:
        with open(image_url, "wb") as file:
            file.write(resp.content)